var endtime = new Date('2019-09-08 17:00:00');
var h = 0;
var m = 0;
var s = 0;

function seckil(){
    var nowtime = new Date();
    var disparity = endtime.getTime() - nowtime.getTime();
    disparity = disparity / 1000;
    disparity = parseInt(disparity);
    console.log(disparity);

    if(disparity >= 0){
        h = parseInt(disparity / 3600);
        m = parseInt(disparity / 36) % 60;
        s = parseInt(disparity % 60);
        if (h < 10){
            h = '0'+ h;
        }
        if (m < 10){
            m = '0'+ m;
        }
        if (s < 10){
            s = '0'+ s;
        }
    }else{
        console.log('秒杀结束，清除计时器');
        clearInterval(t)
    }
    document.querySelector('#h').innerHTML = h;
    document.querySelector('#m').innerHTML = m;
    document.querySelector('#s').innerHTML = s;
}
seckil();
var t = setInterval(function(){
    seckil();
},1000);